@namespace SwashbucklerDiary.Rcl.Components
@typeparam TItem
@typeparam TItemValue
@inherits DialogComponentBase

<CustomMDialog MyValue="Visible"
               MyValueChanged="InternalVisibleChanged"
               ContentClass="rounded-lg"
               Scrollable
               MaxWidth="420">
    <MCard>
        <MCardTitle Class="font-weight-bold flex-nowrap">
            <wc-auto-scroll-text>@Title</wc-auto-scroll-text>
            <MSpacer></MSpacer>
            <MButton Icon="true"
                     OnClick="HandleOnCancel">
                <MIcon>close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText>
            <MRadioGroup Value="Value"
                         TValue="TItemValue"
                         ValueChanged="InternalValueChanged"
                         OnChange="OnChange"
                         Class="mt-0"
                         Row="@Row"
                         HideDetails="@("auto")"
                         Mandatory="true">
                @foreach (var item in Items)
                {
                    <MRadio @key="InternalItemValue(item)"
                            @onclick="HandleOnCancel"
                            Label="@InternalItemText(item)"
                            Value="InternalItemValue(item)"
                            Color="rgba(var(--m-theme-on-surface))">
                    </MRadio>
                }
            </MRadioGroup>
        </MCardText>
    </MCard>
</CustomMDialog>
